package org.example.juc.lock.demo;

import java.util.concurrent.locks.LockSupport;

public class LockPrintABC {
    private static Thread t1 = null;
    private static Thread t2 =null;
    private  static  Thread t3 =null;
    public static void main(String[] args) {
        t1 = new Thread(()->{
            for (int i=0; i <= 26;i++) {
                LockSupport.unpark(t2);
                System.out.print(  Character.toUpperCase( (char)(96+i))  );//大写
                LockSupport.park();
            }

        });
        t1.start();

        t2 = new Thread(()->{

            for (int i=0; i <= 26;i++) {
                LockSupport.park();
                System.out.print((char) (96 + i)); //小写
                LockSupport.unpark(t1);
            }

        });
        t2.start();

    }

}
